<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商户换机,商户迁移列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input name="type" type="hidden" value="2">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">商户编号：</label>
                                <input type="text" name="merno"/>
                            </li>
                            <li>
                                <label style="width: 100px;">商户名称：</label>
                                <input type="text" name="merName"/>
                            </li>
                            <li>
                                <label style="width: 80px;">商户类型：</label>
                                <select name="merType" th:with="type=${@dict.getType('mer_type')}">
                                    <option value="">所有</option>
                                    <option  th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">添加时间：</label>
                                <input type="text" class="time-input" id="start" placeholder="开始时间"
                                       name="params[beginCreatedate]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="end" placeholder="结束时间"
                                       name="params[endCreatedate]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "merchantInfo/merchantInfo";
        var merType = [[${@dict.getType('mer_type')}]];
        var merStatus = [[${@dict.getType('mer_status')}]];
        $(function() {
            var options = {
                url: prefix + "/merUpdateAreaRecordList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                columns: [
                {
                    field: 'id',
                    title: '系统编号'
                },
                {
                    field: 'merno',
                    title: '商户编号'
                },
                {
                    field: 'merName',
                    title: '商户名称'
                },
                {
                    field: 'merType',
                    title: '商户类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(merType, value);
                    }
                },
                {
                    field: 'merStatus',
                    title: '商户状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(merStatus, value);
                    }
                },
                {
                    field: 'oldAddress',
                    title: '原注册地址'
                },
                {
                    field: 'oldDetailed',
                    title: '原详细地址'
                },
                {
                    field: 'newAddress',
                    title: '现注册地址'
                },
                {
                    field: 'newDetailed',
                    title: '现详细地址'
                },
                {
                    field: 'channel',
                    title: '修改渠道',
                    formatter: function(value, row, index) {
                        if(value == 0){
                            return "平台"
                        }else if (value == 1){
                            return "APP"
                        }else{
                            return "未知"
                        }
                    }
                },
                {
                    field: 'addDate',
                    title: '添加时间'
                },

                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>